using System.CodeDom;
using System.Collections.Generic;

namespace Objectinator
{
    public class Class
    {
        private readonly string name;
        private readonly List<Field> fields = new List<Field>();

        public Class(string name)
        {
            this.name = name;
        }

        public void AddDeclaration(CodeNamespace namespaceDeclaration)
        {
            CodeTypeDeclaration classDeclaration = new CodeTypeDeclaration(name);
            classDeclaration.IsClass = true;
            classDeclaration.IsPartial = true;
            foreach (Field field in fields) field.AddDeclaration(classDeclaration);
            namespaceDeclaration.Types.Add(classDeclaration);
        }

        public void AddField(Field field)
        {
            fields.Add(field);
        }
    }
}